/**
 * 主题色控制模块
 */
import themeColor from '@/theme';
export default {
	state: {
		themeType: 'type1',
		navColor: true
	},
	mutations: {
		setTheme(state, type) {
			state.themeType = type;
			uni.setTabBarStyle({
				color: '#C9D1CC',
				selectedColor: themeColor[state.themeType].primary,
				borderStyle: 'white',
				backgroundColor: '#ffffff'
			})
		},
		clearColor(state) {
			state.navColor = !state.navColor;
		}
	},
	getters: {
		$theme(state) {
			return themeColor[state.themeType]
		},
		$navColor(state) {
			if (state.navColor) {
				return themeColor[state.themeType].primary
			} else {
				return '#ffffff'
			}
		}
	}
}